package com.daasuu.easinginterpolator.slice;

import com.daasuu.easinginterpolator.EasingGraphView;
import com.daasuu.easinginterpolator.ResourceTable;
import com.daasuu.ei.Ease;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.ComponentContainer;
import ohos.agp.components.DirectionalLayout;

public class CanvasAbilitySlice extends AbilitySlice {
    private DirectionalLayout layout;
    Ease[] ease = Ease.values();

    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_canvas);
        initView();
    }

    private void initView() {
        layout = (DirectionalLayout) findComponentById(ResourceTable.Id_picLayout);
        createPic();
    }

    private void createPic() {
        for (int i = 0; i < ease.length; i++) {
            EasingGraphView view = new EasingGraphView(this, ease[i]);
            ComponentContainer.LayoutConfig layoutConfig = (ComponentContainer.LayoutConfig) view.getLayoutConfig();
            layoutConfig.height = 500;
            layoutConfig.width = ComponentContainer.LayoutConfig.MATCH_PARENT;
            layout.addComponent(view);
        }
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
